package com.mec.taskassign.service;


import com.mec.taskassign.dao.PlaceMapper;
import com.mec.taskassign.model.Place;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

@Service
public class PlaceServiceImpl implements PlaceService{

    @Autowired
    private PlaceMapper placeMapper;

    @Override
    public List<Place> findAllPlaces(){
        List<Place> place = placeMapper.findAllPlaces();
        return place;
    }


    @Override
    public List<Place> queryPlacesBySearchBox(int page, int limit, String inputValue) {
        int start=(page-1)*limit;       //跳过前面几个
        int number=limit;           //取多少个
        return placeMapper.queryPlacesBySearchBox(start,number,inputValue);
    }

    @Override
    public List<Place> queryAllDataFromTable(int page, int limit) {
        int start=(page-1)*limit;
        int number=limit;
        return placeMapper.queryAllDataFromTable(start,number);
    }

    @Override
    public List<Place> queryObligatoryForm(int page,int limit) {
        int start=(page-1)*limit;       //跳过前面几个
        int number=limit;           //取多少个
        return placeMapper.queryObligatoryForm(start,number);
    }

    @Override
    public List<Place> querySelectableForm(int page, int limit) {
        int start=(page-1)*limit;
        int number=limit;
        return placeMapper.querySelectableForm(start,number);
    }

    @Override
    public List<Place> queryForbiddenForm(int page, int limit) {
        int start=(page-1)*limit;
        int number=limit;
        return placeMapper.queryForbiddenForm(start,number);
    }

    @Override
    public List<Place> findObligatoryPlaces() {
        return placeMapper.findObligatoryPlaces();
    }

    @Override
    public List<Place> findSelectablePlaces() {
        return placeMapper.findSelectablePlaces();
    }

    @Override
    public Place getPlaceById(Integer id) {
        Place place = placeMapper.getPlaceById(id);
        return place;
    }

    @Override
    public void addTask(Place place) {
        placeMapper.addTask(place);
    }



    @Override
    public int queryAllCount() {
        return placeMapper.queryAllCount();
    }

    @Override
    public int queryCertainCount(int pri) {
        return placeMapper.queryCertainCount(pri);
    }

    @Override
    public int querySearchCount(String inputValue) {
        return placeMapper.querySearchCount(inputValue);
    }


    @Override
    public void delete(Integer id) {
        placeMapper.delete(id);
    }

    @Override
    public void reset(Place place) {
        placeMapper.reset(place);
    }


}
